<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2022\2\22 0022
 * Time: 9:44
 */

/**
 * 调用取消订单的支付接口
 */
 function curlCancelOrder($host,$order_num,$user_id)
{
    $curl = curl_init();
    //设置抓取的url
    curl_setopt($curl, CURLOPT_URL, $host.'/bank/pay/order/cancel');
    //设置post方式提交
    curl_setopt($curl, CURLOPT_POST, 1);     //设置post数据
    $post_data = array(
        "user_id" => $user_id,
        "order_num" => $order_num
    );
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
    //执行命令
    $data = curl_exec($curl);
    var_dump($data);

    //关闭URL请求
    curl_close($curl);
    //显示获得的数据
}
$host ='http://localhost:8008';
$order_num='222';
$user_id=214;
curlCancelOrder($host,$order_num,$user_id);